﻿@using Abp.Extensions
@using Abp.Application.Services.Dto
@using KDS.Mes.Web.Models.Common.Modals
@using KDS.Mes.Web.Models.Lines

@model CreateOrEditLineModalViewModel

@* 初始化头部 *@
@Html.Partial("~/Views/Common/Modals/_ModalHeader.cshtml", new ModalHeaderViewModel(Model.IsEditMode ? (L("EditLine") + ": " + Model.Line.WorkshopId) : L("CreateLine")))

<!--html代码区域-->
<div class="modal-body">

    <div class="nav-tabs-custom">
        <ul class="nav nav-tabs ">
            <li class="active"><a href="#LineInformationsTab" data-toggle="tab">@L("Lines")</a></li>
            <li><a href="#AlcCodesTab" data-toggle="tab">@L("AlcCodes")<span class="label label-success" id="assigned-role-count"></span></a></li>
        </ul>
        <div class="tab-content">
            <div class="tab-pane active" id="LineInformationsTab">

                <form name="lineInformationsForm" role="form" novalidate class="form-validation">
                    <input type="hidden" name="Id" value="@Model.Line.Id" />
                    <div>

                        <div hidden="hidden">
                            @if (Model.IsEditMode)
            {
                                <input type="hidden" name="Id" value="@Model.Line.Id" />
                            }
                        </div>

                        <div class="form-group ">
                            <label for="factoryIdEdit">@L("FactoryId")</label>
                            @Html.DropDownList("FactoryId", Model.Factorys.Select(a => a.ToSelectListItem()), new
                       {
                           @class = "form-control selectpicker",
                           data_live_search = "true",
                           title = L("PlaaseSelect"),
                           id = "factoryIdEdit"
                       })
                        </div>

                        <div class="form-group ">
                            <label for="workshopIdEdit">@L("WorkshopId")</label>
                            @Html.DropDownList("WorkshopId", Model.Workshops.Select(a => a.ToSelectListItem()), new
                       {
                           @class = "form-control selectpicker",
                           data_live_search = "true",
                           title = L("PlaaseSelect"),
                           id = "workshopIdEdit"
                       })
                        </div>

                        <div class="form-group ">
                            <label>@L("LineName")   <span class="required"> * </span>	 	</label>
                            <input class="maxlength-handler form-control @(Model.Line.LineName.IsNullOrEmpty() ? "" : " edited")" type="text" name="LineName" value="@Model.Line.LineName" required maxlength="20" />
                        </div>

                        <div class="form-group ">
                            <label>@L("LineCode")   <span class="required"> * </span>	 	</label>
                            <input class="maxlength-handler form-control @(Model.Line.LineCode.IsNullOrEmpty() ? "" : " edited")" type="text" name="LineCode" value="@Model.Line.LineCode" required maxlength="20" />
                        </div>
                        <div class="form-group ">
                            <label for="productModeIdEdit">@L("ProductModeId")</label>
                            @Html.DropDownList("ProductModeId", Model.ProductModes.Select(a => a.ToSelectListItem()), new
                       {
                           @class = "form-control selectpicker",
                           data_live_search = "true",
                           title = L("PlaaseSelect"),
                           id = "productModeIdEdit"
                       })
                        </div>
                    </div>
                </form>
            </div>
            <div class="tab-pane" id="AlcCodesTab">
                <div class="row">
                    <div class="md-checkbox-list user-role-checkbox-list">
                        @foreach (var role in Model.AlcCodes)
                        {
                            <div class="col-sm-2">
                                <div class="md-checkbox">
                                    <input id="EditUser_@(role.AlcCode)" class="md-check" type="checkbox" name="@(role.AlcCode)" value="true" @Html.Raw(role.IsAssigned ? "checked=\"checked\"" : "")>
                                    <label for="EditUser_@(role.AlcCode)">
                                        <span class="inc"></span>
                                        <span class="check"></span>
                                        <span class="box"></span>
                                        @role.AlcCode
                                    </label>
                                </div>
                            </div>
                        }
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
@Html.Partial("~/Views/Common/Modals/_ModalFooterWithSaveAndCancel.cshtml")